<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="https://www.w3.org/1999/xhtml">
<head>
    <meta http-equiv="content-type" content="text/html; charset=utf-8" />
    <title>查看订单 - Powered By ${systemConfig.systemName}</title>  <link rel="icon" href="/template/pc1/images/wmh_favicon.ico" type="image/x-icon" />
    <meta name="Author" content="E-SHOP Team" />
    <meta name="Copyright" content="E-SHOP" />
    <link rel="icon" href="/template/pc1/images/wmh_favicon.ico" type="image/x-icon" />
    <% include("/_view/common/include.html"){}%>
    <link href="/res/css/input.css" rel="stylesheet" type="text/css" />
    <link href="/res/css/common.css" rel="stylesheet" type="text/css" />
    <script type="text/javascript" src="https://static.9hive.cn/global/vendor/layer/layer.js"></script>

    <script type="text/javascript">
        $().ready( function() {

            var $paymentTabButton = $("#paymentTabButton");
            var $shippingTabButton = $("#shippingTabButton");
            var $refundTabButton = $("#refundTabButton");
            var $reshipTabButton = $("#reshipTabButton");

            var $areaSelect = $(".areaSelect");
            var $paymentProcessButton = $("input[name='paymentProcess']");
            var $shippingProcessButton = $("input[name='shippingProcess']");
            var $completedProcessButton = $("input[name='completedProcess']");
            var $refundProcessButton = $("input[name='refundProcess']");
            var $reshipProcessButton = $("input[name='reshipProcess']");
            var $invalidProcessButton = $("input[name='invalidProcess']");
            var tabs = $("ul.tab").tabs();

            // 订单支付
            $paymentProcessButton.click( function() {
                tabs.click(2);
            });

            // 订单发货
            $shippingProcessButton.click( function() {
                tabs.click(3);
            });

            // 订单完成
            $completedProcessButton.click( function() {
                var $this = $(this);
                layer.confirm('订单完成后将不允许对此订单进行任何操作，确认执行？', {
                    btn: ['是','否'] //按钮
                }, function(){
                    $.ajax({
                        url: "completed",
                        data: {"orders.id": "${orders.id}"},
                        dataType: "json",
                        async: false,
                        beforeSend: function() {
                            $this.attr("disabled", true);
                        },
                        success: function(data) {
                            layer.confirm("操作成功!");
                            if (data.status == "success") {
                                $paymentTabButton.attr("disabled", true);
                                $shippingTabButton.attr("disabled", true);
                                $refundTabButton.attr("disabled", true);
                                $reshipTabButton.attr("disabled", true);

                                $paymentProcessButton.attr("disabled", true);
                                $shippingProcessButton.attr("disabled", true);
                                $completedProcessButton.attr("disabled", true);
                                $refundProcessButton.attr("disabled", true);
                                $reshipProcessButton.attr("disabled", true);
                                $invalidProcessButton.attr("disabled", true);
                            } else {
                                $this.attr("disabled", true);
                            }
                        }
                    });
                });

            });

            // 退款
            $refundProcessButton.click( function() {
                tabs.click(4);
            });

            // 退货
            $reshipProcessButton.click( function() {
                tabs.click(5);
            });

            // 作废
            $invalidProcessButton.click( function() {
                var $this = $(this);
                if (confirm("订单作废后将不允许对此订单进行任何操作，确认执行？") == true) {
                    $.ajax({
                        url: "invalid",
                        data: {"orders.id": "${orders.id}"},
                        dataType: "json",
                        async: false,
                        beforeSend: function() {
                            $this.attr("disabled", true);
                        },
                        success: function(data) {
                            //$.message(data.status, data.message);
                            alert(data.message);
                            if (data.status == "success") {
                                $paymentTabButton.attr("disabled", true);
                                $shippingTabButton.attr("disabled", true);
                                $refundTabButton.attr("disabled", true);
                                $reshipTabButton.attr("disabled", true);

                                $paymentProcessButton.attr("disabled", true);
                                $shippingProcessButton.attr("disabled", true);
                                $completedProcessButton.attr("disabled", true);
                                $refundProcessButton.attr("disabled", true);
                                $reshipProcessButton.attr("disabled", true);
                                $invalidProcessButton.attr("disabled", true);
                            } else {
                                $this.attr("disabled", false);
                            }
                        }
                    });
                }
            });

            // 订单支付表单验证
            $("#paymentForm").validate({
                errorClass: "validateError",
                ignore: ".ignoreValidate",
                errorPlacement: function(error, element) {
                    var messagePosition = element.metadata().messagePosition;
                    if("undefined" != typeof messagePosition && messagePosition != "") {
                        var $messagePosition = $(messagePosition);
                        if ($messagePosition.size() > 0) {
                            error.insertAfter($messagePosition).fadeOut(300).fadeIn(300);
                        } else {
                            error.insertAfter(element).fadeOut(300).fadeIn(300);
                        }
                    } else {
                        error.insertAfter(element).fadeOut(300).fadeIn(300);
                    }
                },
                submitHandler: function(form) {
                    $(form).find(":submit").attr("disabled", true);
                    form.submit();
                }
            });

            // 订单发货表单验证
            $("#shippingForm").validate({
                errorClass: "validateError",
                ignore: ".ignoreValidate",
                errorPlacement: function(error, element) {
                    var messagePosition = element.metadata().messagePosition;
                    if("undefined" != typeof messagePosition && messagePosition != "") {
                        var $messagePosition = $(messagePosition);
                        if ($messagePosition.size() > 0) {
                            error.insertAfter($messagePosition).fadeOut(300).fadeIn(300);
                        } else {
                            error.insertAfter(element).fadeOut(300).fadeIn(300);
                        }
                    } else {
                        error.insertAfter(element).fadeOut(300).fadeIn(300);
                    }
                },
                submitHandler: function(form) {
                    $(form).find(":submit").attr("disabled", true);
                    form.submit();
                }
            });

            // 订单退款表单验证
            $("#refundForm").validate({
                errorClass: "validateError",
                ignore: ".ignoreValidate",
                errorPlacement: function(error, element) {
                    var messagePosition = element.metadata().messagePosition;
                    if("undefined" != typeof messagePosition && messagePosition != "") {
                        var $messagePosition = $(messagePosition);
                        if ($messagePosition.size() > 0) {
                            error.insertAfter($messagePosition).fadeOut(300).fadeIn(300);
                        } else {
                            error.insertAfter(element).fadeOut(300).fadeIn(300);
                        }
                    } else {
                        error.insertAfter(element).fadeOut(300).fadeIn(300);
                    }
                },
                submitHandler: function(form) {
                    $(form).find(":submit").attr("disabled", true);
                    form.submit();
                }
            });

            // 订单退货表单验证
            $("#reshipForm").validate({
                errorClass: "validateError",
                ignore: ".ignoreValidate",
                errorPlacement: function(error, element) {
                    var messagePosition = element.metadata().messagePosition;
                    if("undefined" != typeof messagePosition && messagePosition != "") {
                        var $messagePosition = $(messagePosition);
                        if ($messagePosition.size() > 0) {
                            error.insertAfter($messagePosition).fadeOut(300).fadeIn(300);
                        } else {
                            error.insertAfter(element).fadeOut(300).fadeIn(300);
                        }
                    } else {
                        error.insertAfter(element).fadeOut(300).fadeIn(300);
                    }
                },
                submitHandler: function(form) {
                    $(form).find(":submit").attr("disabled", true);
                    form.submit();
                }
            });

        });
    </script>
    <script type="text/javascript">
        $(function () {
            $('#sureReship').attr("disabled",false);
        });

    </script>
    <style type="text/css">
        .tabContent{
            margin-bottom: 100px;
        }
    </style>
</head>
<body>
<div class="path">
    订单管理 &raquo;订单处理
</div>
<ul class="tab">
    <li><input type="button" value="基本信息" hidefocus="true" /></li>
    <li><input type="button" value="商品信息" hidefocus="true" /></li>
    <%if(type == "wl"){%>
        <li><input type="button" id="shippingTabButton" value="订单发货" hidefocus="true" /></li>
    <%}%>
    <li><input type="button" id="refundTabButton" value="退款" hidefocus="true" /></li>
    <li><input type="button" id="reshipTabButton" value="退货" hidefocus="true" /></li>
</ul>
<table class="input tabContent">
    <tr>
        <th>
            订单状态:
        </th>
        <td colspan="3">
            [${i18n("OrderStatus." + orders.orderStatusValue)}]
            [${i18n("PaymentStatus." + orders.paymentStatusValue)}]
            [${i18n("ShippingStatus." + orders.shippingStatusValue)}]
        </td>
    </tr>
    <tr>
        <th>
            订单编号:
        </th>
        <td>
        ${orders.orderSn}
        </td>
        <th>
            下单时间:
        </th>
        <td>
        ${orders.createDate,dateFormat="yyyy-MM-dd HH:mm:ss"}
        </td>
    </tr>
    <tr>
        <th>
            商品总金额:
        </th>
        <td>
            <span id="productTotalPrice" class="red">${orders.productTotalPrice,orderUnitCurrencyFormat}</span>
        </td>
        <th>
            订单总金额:
        </th>
        <td>
            <span id="totalAmount" class="red">${orders.totalAmount,orderUnitCurrencyFormat}</span>&nbsp;&nbsp;
            <strong class="red">[已付金额：${orders.paidAmount,orderUnitCurrencyFormat}]</strong>
        </td>
    </tr>
    <tr>
        <th>
            配送方式:
        </th>
        <td>
        ${orders.deliveryTypeName}
        </td>

        <th>
            配送费用:
        </th>
        <td>
            ${orders.deliveryFee,orderUnitCurrencyFormat}
        </td>
    </tr>
    <tr>
        <th>
            商品重量:
        </th>
        <td>
        ${orders.productWeight}${i18n("WeightUnit." + orders.productWeightUnitValue)}
        </td>
        <th>
            附言:
        </th>
        <td>
        ${orders.memo!"&nbsp;"}
        </td>
    </tr>
    <tr>
        <th>
            收货人姓名:
        </th>
        <td>
        ${orders.shipName}
        </td>
        <th>
            收货地区:
        </th>
        <td>
            <%if(orders.shipArea!="null null null"){%>
                ${orders.shipArea!}
            <%}%>
        </td>
    </tr>
    <tr>
        <th>
            收货地址:
        </th>
        <td>
        ${orders.shipAddress}
        </td>
        <th>
            邮编:
        </th>
        <td>
        ${orders.shipZipCode}
        </td>
    </tr>
    <tr>
        <th>
            电话:
        </th>
        <td>
        ${orders.shipPhone}
        </td>
        <th>
            手机:
        </th>
        <td>
        ${orders.shipMobile}
        </td>
    </tr>
    <tr>
        <td colspan="4">
            <div class="buttonArea">
                <input type="button" class="button" onclick="window.history.back(); return false;" value="返  回" hidefocus="true" />
            </div>
        </td>
    </tr>
</table>
<table class="input tabContent">
    <tr class="title">
        <th>货号</th>
        <th>商品名称</th>
        <th>价格</th>
        <th>购买数量</th>
    </tr>
    <%for(list in orderItemList){%>
    <tr>
        <td>
            <a href="${list.productHtmlFilePath}" target="_blank">
            ${list.productSn}
            </a>
        </td>
        <td>
            <a href="${list.productHtmlFilePath}" target="_blank">
            ${list.productName}
            </a>
        </td>
        <td>
        ${list.productPrice,priceUnitCurrencyFormat}
        </td>
        <td>
        ${list.productQuantity}
        </td>
    </tr>
    <%}%>
    <tr>
        <td colspan="4">
            <div class="buttonArea">
                <input type="button" class="button" onclick="window.history.back(); return false;" value="返  回" hidefocus="true" />
            </div>
        </td>
    </tr>
</table>
<!--<table class="input tabContent">
    <form id="paymentForm" action="payment" method="post">
    <input type="hidden" name="orders.id" value="${orders.id}" />
    <tr>
        <th>
            订单编号:
        </th>
        <td>
        ${orders.orderSn}
        </td>
        <th>
            下单时间:
        </th>
        <td>
        ${orders.createDate,dateFormat="yyyy-MM-dd HH:mm:ss"}
        </td>
    </tr>
    <tr>
        <th>
            订单总金额:
        </th>
        <td>
            <span class="red">${orders.totalAmount,orderUnitCurrencyFormat}</span>
        </td>
        <th>
            已付金额:
        </th>
        <td>
            <span class="red">${orders.paidAmount,orderUnitCurrencyFormat}</span>
        </td>
    </tr>
    <tr>
        <th>
            收款银行:
        </th>
        <td>
            <input type="text" name="payment.bankName" class="formText" />
        </td>
        <th>
            收款账号:
        </th>
        <td>
            <input type="text" name="payment.bankAccount" class="formText" />
        </td>
    </tr>
    <tr>
        <th>
            支付类型:
        </th>
        <td>
            <select name="paymentType">
                <%for(list in nonRechargePaymentTypeList){%>
                <option value="${list}">
                ${i18n("PaymentType." + list)}
                </option>
                <%}%>
            </select>
        </td>
        <th>
            支付方式:
        </th>
        <td>
            <select name="payment.paymentConfig_id">
                <%for(list in allPaymentConfig){%>
                <option value="${list.id}"<%if (list == orders.paymentConfig){%> selected<%}%>>
            ${list.name}
                </option>
                <%}%>
            </select>
        </td>
    </tr>
    <tr>
        <th>
            付款金额:
        </th>
        <td>
            <input type="text" name="payment.totalAmount" class="formText {required: true, positive: true, max: ${orders.totalAmount - orders.paidAmount}}" value="${orders.totalAmount - orders.paidAmount}" />
        </td>
        <th>
            付款人:
        </th>
        <td>
            <input type="text" name="payment.payer" class="formText" />
        </td>
    </tr>
    <tr>
        <th>
            收款单备注:
        </th>
        <td colspan="3">
            <input type="text" name="payment.memo" class="formText" />
        </td>
    </tr>
    <tr>
        <td colspan="4">
            <div class="buttonArea">
                <input type="submit" class="button" value="确  定" hidefocus="true" />&nbsp;&nbsp;&nbsp;&nbsp;
                <input type="button" class="button" onclick="window.history.back(); return false;" value="返  回" hidefocus="true" />
            </div>
        </td>
    </tr>
    </form>
</table>-->
<%if(type == "wl"){%>
<table class="input tabContent ">
    <form id="shippingForm" action="shipping" method="post" class="form-horizontal form-validate">
    <input type="hidden" name="orders.id" value="${orders.id}" />
    <input type="hidden" name="orders.orderSn" value="${orders.orderSn}" />
    <%for(list in orderItemList){%>
        <input type="hidden" name="list.productName" value="${list.productName}" />
    <%}%>
    <!-- 统计行数，后台取Model用 -->
    <input type="hidden" name="orderItemSize" value="${orders.orderItemList.~size}" />
    <%for(list in orderItemList){%>
    <tr>
        <th>
            货号:
        </th>
        <td>
            ${list.productSn}
        </td>
        <th>
            商品名称:
        </th>
        <td>
            ${list.productName}
        </td>
    </tr>
    <tr>
        <th>
            购买数量:
        </th>
        <td>
            ${list.productQuantity}
        </td>
        <th>
            当前库存:
        </th>
        <td>
            <span title="被占用数: ${list.product.freezeStore}">${product.store!0-product.freezeStore}</span>
        </td>
    </tr>
    <tr>
        <th>
            已发货数:
        </th>
        <td>
            ${list.deliveryQuantity}
        </td>
        <th>
            本次发货数:
        </th>
        <td>
            <input type="hidden" name="deliveryItemList[${listLP.index}].product_id" value="${list.product.id}" />
            <input type="hidden" name="deliveryItemList[${listLP.index}].deliveryQuantity" class="formText {required: true, min: 0, max: ${list.productQuantity - list.deliveryQuantity}}" value="${list.productQuantity - list.deliveryQuantity}" style="width: 50px;"/>
            ${list.productQuantity - list.deliveryQuantity}
        </td>
    </tr>
    <%}%>
    <tr>
        <td colspan="4">
            &nbsp;
        </td>
    </tr>
    <tr>
        <th>
            订单编号:
        </th>
        <td>
        ${orders.orderSn}
        </td>
        <th>
            下单时间:
        </th>
        <td>
        ${orders.createDate,dateFormat="yyyy-MM-dd HH:mm:ss"}
        </td>
    </tr>
    <tr>
        <th>
            配送方式:
        </th>
        <td>
            <select name="shipping.deliveryType_id">
                <%for(list in allDeliveryType){%>
                <option value="${list.id}"<%if (list == orders.deliveryType){%> selected<%}%>>
                    ${list.name}
                </option>
                <%}%>
            </select>
        </td>
        <th>
            配送费用:
        </th>
        <td>
            <span class="red">${orders.deliveryFee,orderUnitCurrencyFormat}</span>
        </td>
    </tr>
    <tr>
        <th>
            物流公司:
        </th>
        <td>
            <select name="shipping.deliveryCorpName">
                <%for(list in allDeliveryCorp){%>
                    <option value="${list.name}" <%if (list == orders.deliveryCorp){%> selected<%}%>>
                        ${list.name}
                    </option>
                <%}%>
            </select>
        </td>
        <th>
            物流编号:
        </th>
        <td>
            <input type="text" name="shipping.deliverySn" class="formText {required: true}" />
        </td>
    </tr>
    <tr>
        <th>
            物流费用:
        </th>
        <td colspan="3">
            <input type="text" name="shipping.deliveryFee" class="formText {min: 0}" value="${orders.deliveryFee}" />
        </td>
    </tr>
    <tr>
        <td colspan="4">
            &nbsp;
        </td>
    </tr>
    <tr>
        <th>
            收货人姓名:
        </th>
        <td>
            <input type="text" name="shipping.shipName" class="" value="${orders.shipName}" />
        </td>
        <th>
            收货地区:
        </th>
        <td>
            <div class="controls">
                <select class="sel-provance">
                    <option value="${receiver.provinceId!}">${receiver.province!}</option>
                </select>
                <select class="sel-city">
                    <option value="${receiver.cityId!}">${receiver.city!}</option>
                </select>
                <select class="sel-area">
                    <option value="${receiver.areaId!}">${receiver.area!}</option>
                </select>
            </div>
        </td>
    </tr>
    <tr>
        <th>
            收货地址:
        </th>
        <td>
            <input type="text" name="shipping.shipAddress" class="formText {required: true}" value="${orders.shipAddress}" />
        </td>
        <th>
            邮编:
        </th>
        <td>
            <input type="text" name="shipping.shipZipCode" class="formText {required: true, zipCode: true}" value="${orders.shipZipCode}" />
        </td>
    </tr>
    <tr>
        <th>
            电话:
        </th>
        <td>
            <input type="text" name="shipping.shipPhone" class="formText {requiredOne: '#shipMobile', phone: true}" value="${orders.shipPhone}" />
        </td>
        <th>
            手机:
        </th>
        <td>
            <input type="text" name="shipping.shipMobile"  class="formText {mobile: true}" value="${orders.shipMobile}" />
        </td>
    </tr>
    <tr>
        <th>
            发货备注:
        </th>
        <td colspan="3">
            <input type="text" name="shipping.memo" class="formText" />
        </td>
    </tr>
    <tr>
        <td colspan="4">
            <div class="buttonArea">
                <input type="submit" class="button" value="确  定" hidefocus="true" />&nbsp;&nbsp;&nbsp;&nbsp;
                <input type="button" class="button" onclick="window.history.back(); return false;" value="返  回" hidefocus="true" />
            </div>
        </td>
    </tr>
    </form>
</table>
<%}%>
<table class="input tabContent">
    <form id="refundForm" action="recheckfund" method="post">
        <input type="hidden" name="orders.id" value="${orders.id}" />
        <tr>
            <th>
                订单编号:
            </th>
            <td>
            ${orders.orderSn}
            </td>
            <th>
                下单时间:
            </th>
            <td>
            ${orders.createDate,dateFormat="yyyy-MM-dd HH:mm:ss"}
            </td>
        </tr>
        <tr>
            <th>
                订单总金额:
            </th>
            <td>
                <span class="red">${orders.totalAmount,orderUnitCurrencyFormat}</span>
            </td>
            <th>
                已付金额:
            </th>
            <td>
                <span class="red">${orders.paidAmount,orderUnitCurrencyFormat}</span>
            </td>
        </tr>
        <tr>
            <th>
                退款银行:
            </th>
            <td>
                <input type="text" name="refund.bankName" class="formText" />
            </td>
            <th>
                退款账号:
            </th>
            <td>
                <input type="text" name="refund.bankAccount" class="formText" />
            </td>
        </tr>
        <tr>
            <th>
                退款方式:
            </th>
            <td>
                <select disabled="disabled" name="refund.paymentConfig_id">
                    <%for(list in allPaymentConfig){%>
                    <option value="${list.id}"<%if (list == orders.paymentConfig){%> selected<%}%>>
                        ${list.name}
                    </option>
                    <%}%>
                </select>
            </td>
        </tr>
        <tr>
            <th>
                退款金额:
            </th>
            <td>
                <input type="text" name="refund.totalAmount" class="formText {required: true, positive: true, max: ${orders.paidAmount}}" value="${orders.paidAmount}" />
            </td>
            <th>
                收款人:
            </th>
            <td>
                <input type="text" name="refund.payee" class="formText{required: true}" />
            </td>
        </tr>
        <tr>
            <th>
                退款备注:
            </th>
            <td colspan="3">
                <input type="text" name="refund.memo" class="formText" />
            </td>
        </tr>
        <tr>
            <td colspan="4">
                <div class="buttonArea">
                    <input type="submit" class="button" value="确  定" hidefocus="true" />&nbsp;&nbsp;&nbsp;&nbsp;
                    <input type="button" class="button" onclick="window.history.back(); return false;" value="返  回" hidefocus="true" />
                </div>
            </td>
        </tr>
    </form>
</table>
<table class="input tabContent">
    <form id="reshipForm" action="reship" method="post">
    <input type="hidden" name="orders.id" value="${orders.id}" />
    <!-- 统计行数，后台取Model用 -->
    <input type="hidden" name="orderItemSize" value="${orders.orderItemList.~size}" />
    <%for(list in orderItemList){%>
        <tr>
            <th>货号:</th>
            <td><input type="hidden" name="deliveryItemList[${listLP.index}].product_id" value="${list.product.id}" />${list.productSn}</td>
            <th>商品名称:</th>
            <td>${list.productName}</td>
        </tr>
        <tr>
            <th>购买数量:</th>
            <td>${list.productQuantity}</td>
            <th>已发货数:</th>
            <td>${list.deliveryQuantity}</td>
        </tr>
        <tr>
            <th>本次退货数:</th>
            <td><input type="text" name="deliveryItemList[${listLP.index}].deliveryQuantity" class="formText {required: true, min: 0, max: ${list.deliveryQuantity}}" value="${list.deliveryQuantity}" style="width: 50px;" /></td>
            <th></th>
            <td></td>
        </tr>
    <%}%>
    <tr>
        <td colspan="4">
            &nbsp;
        </td>
    </tr>
    <tr>
        <th>
            订单编号:
        </th>
        <td name="reship.order_id">
        ${orders.orderSn}
        </td>
        <th>
            下单时间:
        </th>
        <td>
        ${orders.createDate,dateFormat="yyyy-MM-dd HH:mm:ss"}
        </td>
    </tr>
    <tr>
        <th>
            物流公司:
        </th>
        <td>
            <select name="reship.deliveryCorpName">
                <%for(list in allDeliveryCorp){%>
                <option value="${list.name}" <%if (list == orders.deliveryCorp){%> selected<%}%>>
                ${list.name}
                </option>
                <%}%>
            </select>
        </td>
    </tr>
    <tr>
        <th>
            物流费用:
        </th>
        <td>
            <input type="text" name="reship.deliveryFee" class="formText {min: 0}" value="${orders.deliveryFee}" />
        </td>
        <th>
            物流编号:
        <td>
            <input type="text" name="reship.deliverySn" class="formText {required: true}" />
        </td>
    </tr>
    <tr>
        <td colspan="4">
            &nbsp;
        </td>
    </tr>
    <tr>
        <th>
            退货人姓名:
        </th>
        <td>
            <input type="text" name="reship.shipName" class="formText {required: true}" value="${orders.shipName}" />
        </td>
        <th>
            退货地区:
        </th>
        <td>
            <div class="controls">
                <select class="sel-provance">
                    <option value="${receiver.provinceId!}">${receiver.province!}</option>
                </select>
                <select class="sel-city">
                    <option value="${receiver.cityId!}">${receiver.city!}</option>
                </select>
                <select class="sel-area">
                    <option value="${receiver.areaId!}">${receiver.area!}</option>
                </select>
            </div>
        </td>
    </tr>
    <tr>
        <th>
            退货地址:
        </th>
        <td>
            <input type="text" name="reship.shipAddress" class="formText {required: true}" value="${orders.shipAddress}" />
        </td>
        <th>
            邮编:
        </th>
        <td>
            <input type="text" name="reship.shipZipCode" class="formText {required: true, zipCode: true}" value="${orders.shipZipCode}" />
        </td>
    </tr>
    <tr>
        <th>
            电话:
        </th>
        <td>
            <input type="text" name="reship.shipPhone" class="formText {requiredOne: '#shipMobile', phone: true}" value="${orders.shipPhone}" />
        </td>
        <th>
            手机:
        </th>
        <td>
            <input type="text" name="reship.shipMobile" id="shipMobile" class="formText {mobile: true}" value="${orders.shipMobile}" />
        </td>
    </tr>
    <tr>
        <th>
            退货备注:
        </th>
        <td colspan="3">
            <input type="text" name="reship.memo" class="formText" />
        </td>
    </tr>
    <tr>
        <td colspan="4">
            <div class="buttonArea">
                <input type="submit" id="sureReship" class="button" value="确  定" hidefocus="true" />&nbsp;&nbsp;&nbsp;&nbsp;
                <input type="button" class="button" onclick="window.history.back(); return false;" value="返  回" hidefocus="true" />
            </div>
        </td>
    </tr>
    </form>
</table>

</body>
<script>
    $(function () {
        //初始化省市区
        $.ajax({
            url: "getAreaByParent",
            type: 'GET',
            dataType:'json',
            data:{
                "parent_id":""
            },
            success: function(data){
                if(data.state=='ok'){
                    $(".sel-provance").append(data.info);
                    //var firstProvinceId = $('.sel-provance').find("option:selected").next().val();
                }

            }
        });

        //省级改变
        $(".sel-provance").change(function () {
            var parent_id=this.value;
            //1.将区域清空
            $(".sel-area").html('<option value="">请选择</option>');
            //如果不选择区域,将城市清空
            if(!parent_id){
                $(".sel-city").html('<option value="">请选择</option>');
            }else{
                $.ajax({
                    url: "getAreaByParent",
                    type: 'GET',
                    data:{
                        "parent_id":parent_id
                    },
                    success: function(data){
                        if(data.state=='ok'){
                            $(".sel-city").html(data.info);
                            parent_id=$(".sel-city").val();//取出当前选中城市id,根据当前选中的城市id,换取区域列表
                            $.ajax({
                                url: "getAreaByParent",
                                type: 'GET',
                                data:{
                                    "parent_id":parent_id
                                },
                                success: function(data){
                                    if(data.state=='ok'){
                                        $(".sel-area").html(data.info);
                                    }
                                }
                            });
                        }else{
                            layer.msg(data.info);
                        }
                    }
                });
            }
        });

        //城市改变
        $(".sel-city").change(function () {
            var parent_id=this.value;
            $.ajax({
                url: "getAreaByParent",
                type: 'GET',
                data:{
                    "parent_id":parent_id
                },
                success: function(data){
                    if(data.state=='ok'){
                        $(".sel-area").html(data.info);
                    }
                }
            });
        });
    })
</script>
</html>
